import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bmfmap_example/models/userinformodel.dart';
import 'package:provider/provider.dart';

class ModifyintroPage extends StatefulWidget {
  const ModifyintroPage({Key key}) : super(key: key);

  @override
  _ModifyintroPageState createState() => _ModifyintroPageState();
}

class _ModifyintroPageState extends State<ModifyintroPage> {
  String intro;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: <Widget>[
          InkWell(
            onTap: () {
              //  ChangeNotifierProvider<Userinfomodel>.value(context, listen: false);

              context.read<Userinfomodel>().setauthorization(intro);
            },
            child: Padding(
              padding: const EdgeInsets.all(14.0),
              child: Container(
                width: 50,
                decoration: new BoxDecoration(
                  color: Colors.grey,
                  borderRadius: new BorderRadius.circular((50.0)),
                ),
                child: Center(child: Text('保存')),
              ),
            ),
          )
        ],
        centerTitle: true,
        title: Text(
          '更改简介',
          style: TextStyle(
            fontSize: 16,
            color: Color.fromRGBO(72, 72, 72, 1),
            fontWeight: FontWeight.bold,
          ),
        ),
        backgroundColor: Colors.white,
        // backgroundColor: Color.fromRGBO(252, 252, 189, 1),
        elevation: 0,
        iconTheme: IconThemeData(color: Colors.black54),
      ),
      body: Padding(
        padding: const EdgeInsets.only(left: 20, right: 20),
        child: TextField(
          maxLength: 30,
          onChanged: (value) {
            intro = value;
          },
          decoration: InputDecoration(
            hintText: context.read<Userinfomodel>().getauthorization(),
            contentPadding: EdgeInsets.all(10.0),
            helperText: '请输入你自己的简介',
          ),
        ),
      ),
    );
  }
}
